/*
 * @Author: 🐝小蜜蜂🐝 
 * @Date: 2023-04-25 22:03:24
 * @LastEditTime: 2023-06-15 09:58:14
 * @LastEditors: 小蜜蜂 84537795@qq.com
 * @Description: 路由页面
 * @FilePath: /handheld-terminal-app/lib/routes/routes.dart
 * @CopyRight：小蜜蜂🐝  QQ：834537795
 */

import 'package:flutter/material.dart';
import 'package:material_collection_app/pages/add_material_page.dart';
import 'package:material_collection_app/pages/approval_page.dart';
import 'package:material_collection_app/pages/check_detail_page.dart';
import 'package:material_collection_app/pages/check_page.dart';
import 'package:material_collection_app/pages/check_result._page.dart';
import 'package:material_collection_app/pages/check_inventory_result_page.dart'; //盘点结果页面
import 'package:material_collection_app/pages/data_analysis_page.dart';
import 'package:material_collection_app/pages/data_statistics_page.dart';
import 'package:material_collection_app/pages/material_type_page.dart';
import 'package:material_collection_app/pages/message_page.dart';
import 'package:material_collection_app/pages/new_enter_page.dart';
import 'package:material_collection_app/pages/out_detai_page.dart';
import 'package:material_collection_app/pages/out_dqd_page.dart';
import 'package:material_collection_app/pages/out_page.dart';
import 'package:material_collection_app/pages/history_page.dart';
import 'package:material_collection_app/pages/home_page.dart';
import 'package:material_collection_app/pages/login_page.dart';
import 'package:material_collection_app/pages/manage_detail_page.dart';
import 'package:material_collection_app/pages/manage_page.dart';
import 'package:material_collection_app/pages/my_page.dart';
import 'package:material_collection_app/pages/part_out_library_page.dart';
import 'package:material_collection_app/pages/personal_center_page.dart';
import 'package:material_collection_app/pages/photo_view_simple.dart';
import 'package:material_collection_app/pages/rfid_detail_page.dart';
import 'package:material_collection_app/pages/rfid_scan_page.dart';
import 'package:material_collection_app/pages/scan_results_page.dart';
import 'package:material_collection_app/pages/scrap_enter_page.dart';
import 'package:material_collection_app/pages/task_check_page.dart';
import 'package:material_collection_app/pages/task_detail_page.dart';
import 'package:material_collection_app/pages/task_out_library_page.dart';
import 'package:material_collection_app/pages/task_page.dart';
import 'package:material_collection_app/pages/enter_page.dart';
import 'package:material_collection_app/pages/enter_detail_page.dart';
import 'package:material_collection_app/pages/enter_dqd_page.dart';
import 'package:material_collection_app/pages/enter_check_page.dart';
import 'package:material_collection_app/pages/update_password_page.dart';
import 'package:material_collection_app/pages/video_play_page.dart';
import 'package:material_collection_app/pages/son_material.dart';
import 'package:material_collection_app/pages/son_out_material.dart';
import 'package:material_collection_app/pages/allocate_enter_page.dart';

final routes = {
  '/': (context) => HomePage(),
  '/my': (context) => MyPage(),
  '/login': (context) => LoginPage(),
  '/new_enter': (context) => NewEnterPage(),
  '/enter': (context, {arguments}) => EnterPage(arguments: arguments),
  '/enter_dqd': (context, {arguments}) => EnterCheckPage(arguments: arguments),
  '/enter_detail': (context, {arguments}) =>
      EnterDetailPage(arguments: arguments),
  '/enter_check': (context, {arguments}) => EnterQdPage(arguments: arguments),
  '/out_page': (context, {arguments}) => OutPage(arguments: arguments),
  '/out_dqd_page': (context, {arguments}) => OutDqdPage(arguments: arguments),
  '/out_detail': (context, {arguments}) => OutDetailPage(arguments: arguments),
  '/check': (context) => CheckPage(),
  '/check_detail': (context, {arguments}) =>
      CheckDetailPage(arguments: arguments),
  '/task': (context) => TaskPage(),
  '/task_detail': (context, {arguments}) =>
      TaskDetailPage(arguments: arguments),
  '/task_enter_check': (context, {arguments}) =>
      TaskCheckPage(arguments: arguments),
  '/task_out_library': (context, {arguments}) =>
      TaskOutLibraryPage(arguments: arguments),
  '/part_qut_library': (context, {arguments}) =>
      PartOutLibraryPage(arguments: arguments),
  '/approval': (context) => ApprovalPage(),
  '/data_analysis': (context) => DataAnalysis(),
  '/personal_center': (context) => PersonalCenterPage(),
  '/update_password': (context) => UpdatePassword(),
  '/manage': (context) => ManagePage(),
  '/manage_detail': (context, {arguments}) =>
      ManageDetailPage(arguments: arguments),
  '/history': (context) => HistoryPage(),
  '/data_statistics': (context) => DataStatisticsPage(),
  '/scan_result': (context, {arguments}) =>
      ScanResultPage(arguments: arguments),
  '/material_type': (context, {arguments}) =>
      MaterialTypePage(arguments: arguments),
  '/message': (context) => MessagePage(),
  '/photo_view': (context, {arguments}) =>
      PhotoViewGalleryScreen(arguments: arguments),
  '/add_material': (context, {arguments}) =>
      AddMaterialPage(arguments: arguments),
  '/rfid_scan': (context) => RfidScanPage(),
  '/rfid_detail': (context, {arguments}) =>
      RfidDetailPage(arguments: arguments),
  '/scrap_enter': (context, {arguments}) =>
      ScrapEnterPage(arguments: arguments),
  '/check_result': (context, {arguments}) =>
      CheckResultPage(arguments: arguments),
  '/check_inventory_result': (context, {arguments}) =>
      CheckInventoryResultPage(arguments: arguments),
  '/video_play': (context, {arguments}) => VideoPlayPage(arguments: arguments),
  '/son_material': (context, {arguments}) =>
      SonMaterialPage(arguments: arguments),
  '/son_out_material': (context, {arguments}) =>
      SonOutMaterialPage(arguments: arguments),
  '/allocate_enter': (context, {arguments}) =>
      AllocateEnterPage(arguments: arguments),
};

//统一处理命名路由
var onGenerateRoute = (RouteSettings settings) {
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    //能寻找到对应的路由
    if (settings.arguments != null) {
      //页面跳转前有传参
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      //页面跳转前没有传参
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
